package com.sys.util;

import java.net.FileNameMap;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@SuppressWarnings("unused")
public class FileUtils {

    private final static String PREFIX_VIDEO = "video/";
    private final static List<String> videoList = new ArrayList<>(Arrays.asList(".mp4", ".avi", ".mov", ".wmv", ".asf", ".navi", ".3gp", ".mkv", ".f4v", ".rmvb", ".webm"));
    private final static List<String> txtList = new ArrayList<>(Arrays.asList(".txt", ".doc", ".docx", ".xls", ".htm", ".html", ".jsp", ".rtf", ".wpd", ".pdf", ".ppt"));
    private final static List<String> musicList = new ArrayList<>(Arrays.asList(".mp3", ".wma", ".wav", ".mod", ".ra", ".cd", ".md", ".asf", ".aac", ".vqf", ".ape", ".mid", ".ogg", ".m4a", ".vqf"));
    private final static List<String> picList = new ArrayList<>(Arrays.asList(".bmp", ".jpg", ".jpeg", ".png", ".tiff", ".gif", ".pcx", ".tga", ".exif", ".fpx", ".svg", ".psd", ".cdr", ".pcd", ".dxf", ".ufo", ".eps", ".ai", ".raw", ".wmf"));

    private static String getMimeType(String fileName) {
        FileNameMap fileNameMap = URLConnection.getFileNameMap();
        return fileNameMap.getContentTypeFor(fileName);
    }

    public static boolean isVideoFile(String fileName) {
        if (stringUtils.StringIsEmptyOrNull(fileName)) {
            return false;
        }
        String fileType = fileName.substring(fileName.lastIndexOf("."), fileName.length());
        return fileType.toLowerCase().contains(".mp4");
    }
}
